#include <catch2/catch.hpp>

#include <array>

#include "solution.hpp"

using namespace solution_590;

TEST_CASE("590_n-ary_tree_postorder_traversal", "[590]")
{
    auto nodes = std::array { Node(0), Node(1), Node(2), Node(3), Node(4), Node(5), Node(6) };
    nodes[1].children = { &nodes[3], &nodes[2], &nodes[4] };
    nodes[3].children = { &nodes[5], &nodes[6] };
    CHECK(Solution().postorder(&nodes[1]) == std::vector{5,6,3,2,4,1});
    CHECK(Solution().postorder2(&nodes[1]) == std::vector{5,6,3,2,4,1});
}
